package com.fxu.gen.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/**
 * 字段类型
 */
@AllArgsConstructor
public enum ClnType implements BaseEnum {
    //1:String,2:Boolean,3:Integer,4:Long,5:Float,6:Double,7:Decimal,8:Date,9:Text,10:Blob
    STRING(1, "字符串"),
    BOOLEAN(2, "布尔"),
    INTEGER(3, "整型"),
    LONG(4, "长整型"),
    FLOAT(5, "浮点数"),
    DOUBLE(6, "双浮点数"),
    DECIMAL(7, "精确小数"),
    DATE(11, "日期"),
    DATETIME(8, "时间"),
    TEXT(9, "文本"),
    BLOB(10, "长文本"),
    ;

    int code;
    String desc;

    @Override
    public Integer code() {
        return code;
    }
    @Override
    public String desc() {
        return desc;
    }

    public static ClnType find(Integer code) {
        return code == null ? null : BaseEnum.findOne(ClnType.values(), v -> code.equals(v.code));
    }
}